# from database.sqlite.tsdb import TSDB
# from database.sqlite.historydb import historyDB
# # from database.basedb import BaseDB
#
# import os
# import time
# import unittest
# import json
#
# import shutil
#
#
# class TestProcessor(unittest.TestCase):
#     resultdb_path = './data/tests/time_series.db'
#     historydb_path = './data/tests/history.db'
#
#     def test_setUpClass(self):
#         shutil.rmtree('./data/tests/', ignore_errors=True)
#         os.makedirs('./data/tests/')
#
#         def get_resultdb():
#             return TSDB(self.resultdb_path)
#
#         db = get_resultdb()
#         db.save(project='test',
#                 result=json.dumps({'a':123})
#             )
#         ret = db.select(project='test',)
#         print(next(ret))
#
#     def test_history(self):
#         shutil.rmtree('./data/tests/', ignore_errors=True)
#         os.makedirs('./data/tests/')
#
#         def get_resultdb():
#             return historyDB(self.historydb_path)
#
#         db = get_resultdb()
#         db.save(project='test',
#                 result={'a':123},loginUserName='jack',publishTime=1499577216781,uid="15072219-3810-9000-0200-000303426564"
#             )
#         ret = db.select(project='test',)
#         for each in ret:
#             print(each)
#
# if __name__=='__main__':
#     unittest.main()
#
#


import requests
# from bs4 import BeautifulSoup
# headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
# url='https://www.linkedin.com/jobs/view/praktikant-(m-w)-im-bereich-vertrieb-(iam-sales-europe)-at-johnson-controls-476374566/'
# html=requests.get(url,headers)
# soup=BeautifulSoup(html.text,'lxml')
# message=soup.findAll(id='decoratedJobPostingModule')
# message_for=message[0].get_text()
# print(message_for)

# url = 'http://61.171.81.113:672/v1/upload'
# url = 'https://x.mouto.org/wb/x.php?up'

file = '/home/ider/Pictures/4chan.png'
# data = {'file':open(file,'rb'),'name':"file", 'filename':"005.jpg", 'Content-Type':'image/jpeg'
# }
# req = requests.post(url,files=data)

# headers = {
#     'origin': "http://www.etnaa.xyz",
#     'x-devtools-emulate-network-conditions-client-id': "769f8b43-04f8-4a10-b30a-07ca558c58fd",
#     'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36",
#     'content-type': "image/jpeg",
#     'accept': "*/*",
#     'referer': "http://www.etnaa.xyz/ceshi/tuchuang/",
#     'accept-encoding': "gzip, deflate, br",
#     'accept-language': "zh-CN,zh;q=0.9,en;q=0.8",
#     'cache-control': "no-cache",
#     }



# response = requests.request("POST", url, data=open(file,'rb'))



url = 'http://61.171.85.237:672/v1/upload'



data = {'file':open(file,'rb'),'name':"file", 'Content-Type':'image/jpeg'}
response = requests.request("POST", url, files=data)
print(response.text)


# https://ww4.sinaimg.cn/large/a15b4afely1fnxlzv5hb9j20cg06owfa